package com.hp.tiger.concurrent.classloader.chapter4;

import java.io.FileInputStream;
import java.io.FileOutputStream;

/**
 * @author XavierDong
 **/
public final class EncryptUtils {

    public static final byte ENCRYPT_FACTOR = (byte) 0xff;


    private EncryptUtils() {
    }


    public static void doEncrypt(String source, String target) {

        try (FileInputStream fis = new FileInputStream(source); FileOutputStream fos = new FileOutputStream(target)) {

            int data;
            while ((data=fis.read())!= -1) {
                fos.write(data ^ ENCRYPT_FACTOR);
            }
        } catch (Exception e
        ) {

        }
    }

    public static void main(String[] args) {

    }

}
